#include "game.h"

#include <algorithm>
#include <random>
#include <vector>

std::vector<int> guess(int n, int limit) {
  std::vector<int> ans;
  ans.resize(n);
  for (int i = 1; i <= n; i++) {
    ans[i - 1] = i;
  }
  std::mt19937 rng(n ^ 0x3b800001);
  std::shuffle(ans.begin(), ans.end(), rng);
  int r = count(ans);
  if (r == n) {
    return ans;
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < i; ++j) {
      std::swap(ans[i], ans[j]);
      int c = count(ans);
      if (c > r) {
        r = c;
        if (r == n) {
          return ans;
        }
      } else {
        std::swap(ans[i], ans[j]);
      }
    }
  }
  return ans;
}